

    \filetitle{model}{Create new model object based on model file}{model/model}

	\paragraph{Syntax}

\begin{verbatim}
M = model(FName,...)
M = model(M,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{FName} {[} char \textbar{} cellstr {]} - Name(s) of model
  file(s) that will be loaded and converted to a new model object.
\item
  \texttt{M} {[} model {]} - Existing model object that will be rebuilt
  as if from a model file.
\end{itemize}

\paragraph{Output arguments}

\begin{itemize}
\tightlist
\item
  \texttt{M} {[} model {]} - New model object based on the input model
  code file or files.
\end{itemize}

\paragraph{Options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}assign=\textquotesingle{}} {[} struct
  \textbar{} \emph{empty} {]} - Assign model parameters and/or steady
  states from this database at the time the model objects is being
  created.
\item
  \texttt{\textquotesingle{}baseYear=\textquotesingle{}} {[} numeric
  \textbar{} \emph{2000} {]} - Base year for constructing deterministic
  time trends.
\item
  \texttt{\textquotesingle{}blazer=\textquotesingle{}} {[}
  \emph{\texttt{true}} \textbar{} \texttt{false} {]} - Perform
  block-recursive analysis of steady-state equations at the time the
  model object is being created; the option works only in nonlinear
  models.
\item
  \texttt{\textquotesingle{}comment=\textquotesingle{}} {[} char
  \textbar{} \emph{empty} {]} - Text comment attached to the model
  object.
\item
  \texttt{\textquotesingle{}declareParameters=\textquotesingle{}} {[}
  \emph{\texttt{true}} \textbar{} \texttt{false} {]} - If
  \texttt{false}, skip parameter declaration in the model file, and
  determine the list of parameters automatically as names found in
  equations but not declared.
\item
  \texttt{\textquotesingle{}epsilon=\textquotesingle{}} {[} numeric
  \textbar{} \emph{eps\^{}(1/4)} {]} - The minimum relative step size
  for numerical differentiation.
\item
  \texttt{\textquotesingle{}linear=\textquotesingle{}} {[} \texttt{true}
  \textbar{} \emph{\texttt{false}} {]} - Indicate linear models.
\item
  \texttt{\textquotesingle{}makeBkw=\textquotesingle{}} {[}
  \emph{\texttt{@auto}} \textbar{} \texttt{@all} \textbar{} cellstr
  \textbar{} char {]} - Variables included in the list will be made part
  of the vector of backward-looking variables; \texttt{@auto} means the
  variables that do not have any lag in model equations will be put in
  the vector of forward-looking variables.
\item
  \texttt{\textquotesingle{}multiple=\textquotesingle{}} {[} true
  \textbar{} \emph{false} {]} - Allow each variable, shock, or parameter
  name to be declared (and assigned) more than once in the model file.
\item
  \texttt{\textquotesingle{}optimal=\textquotesingle{}} {[} cellstr {]}
  - Specify optimal policy options, see below; only applies when the
  keyword \href{modellang/min}{\texttt{min}} is used in the model file.
\item
  \texttt{\textquotesingle{}removeLeads=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - Remove all leads
  from the state-space vector, keep included only current dates and
  lags.
\item
  \texttt{\textquotesingle{}sstateOnly=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - Read in only the
  steady-state versions of equations (if available).
\item
  \texttt{\textquotesingle{}std=\textquotesingle{}} {[} numeric
  \textbar{} \texttt{@auto} {]} - Default standard deviation for model
  shocks; \texttt{@auto} means \texttt{1} for linear models and
  \texttt{log(1.01)} for nonlinear models.
\item
  \texttt{\textquotesingle{}userdata=\textquotesingle{}} {[} \ldots{}
  \textbar{} \emph{empty} {]} - Attach user data to the model object.
\end{itemize}

\paragraph{Optimal policy options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}multiplierPrefix=\textquotesingle{}} {[}
  char \textbar{}
  \emph{\texttt{\textquotesingle{}Mu\_\textquotesingle{}}} {]} - Prefix
  used to create names for lagrange multipliers associated with the
  optimal policy problem; the prefix is followed by the equation number.
\item
  \texttt{\textquotesingle{}nonnegative=\textquotesingle{}} {[} cellstr
  {]} - List of variables constrained to be nonnegative.
\item
  \texttt{\textquotesingle{}type=\textquotesingle{}} {[}
  \texttt{\textquotesingle{}commitment\textquotesingle{}} \textbar{}
  \emph{\texttt{\textquotesingle{}discretion\textquotesingle{}}} {]} -
  Type of optimal policy.
\end{itemize}

\paragraph{Description}

Loading a model file ----------------------

The \texttt{model} function can be used to read in a
\href{modellang/Contents}{model file} named \texttt{fname}, and create a
model object \texttt{m} based on the model file. You can then work with
the model object in your own m-files, using using the IRIS
\href{model/Contents}{model functions} and standard Matlab functions.

If \texttt{fname} is a cell array of more than one file names then all
files are combined together in order of appearance.

Re-building an existing model object
--------------------------------------

The only instance where you may need to call a model function on an
existing model object is to change the
\texttt{\textquotesingle{}removeLeads=\textquotesingle{}} option. Of
course, you can always achieve the same by loading the original model
file.

\paragraph{Example}

Read in a model code file named \texttt{my.model}, and declare the model
as linear:

\begin{verbatim}
m = model('my.model','linear',true);
\end{verbatim}

\paragraph{Example}

Read in a model code file named \texttt{my.model}, declare the model as
linear, and assign some of the model parameters:

\begin{verbatim}
m = model('my.model','linear=',true,'assign=',P);
\end{verbatim}

Note that this is equivalent to

\begin{verbatim}
m = model('my.model','linear=',true);
m = assign(m,P);
\end{verbatim}

unless some of the parameters passed in to the \texttt{model} fuction
are needed to evaluate \href{modellang/if}{\texttt{if}} or
\href{modellang/switch}{\texttt{!switch}} expressions.


